<!doctype html>
<html  class="x-admin-sm">
<head>
	<meta charset="UTF-8">
	<title>后台登录-娄志宇</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/login.css">
	  <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script src="./lib/layui/layui.js" charset="utf-8"></script>
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="login-bg">
    
    <div class="login layui-anim layui-anim-up">
        <div class="message">登录</div>
        <div id="darkbannerwrap"></div>
        
        <form  class="layui-form" >
            <input name="uname" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" >
            <hr class="hr15">
            <input name="upassword"   lay-verify="required" placeholder="密码"  type="password" class="layui-input">
            <hr class="hr15">
            <input  value="点击登录" lay-submit="" lay-filter="login" style="width:100%;" type="submit">
            <hr class="hr20" >
        </form>
        <!--<button style="width:50%;" type="submit" onclick="">-->
        <!--注册<a href="....b.jsp">-->
        <!--</button>-->
        <input type="button" value="注册" onclick="document.location.href='zhuce.html'"/>
    </div>

    <script>

    layui.use('form', function(){
        var form = layui.form;
        var $ = layui.$;
      // layer.msg('玩命卖萌中', function(){
      //   //关闭后的操作
      //   });
      //监听提
        form.on('submit(zhuce)', function(){
          window.href="./zhuce.html";
        });
      form.on('submit(login)', function(data){

          $.ajax({
              url:'../user/check'
              ,type:'Post'
               ,data: data.field
              ,success:function (d){

                  if(d===0 ){
                      layer.msg('登录失败！！！用户名密码是否为空或输入错误，请重新输入', {
                          icon: 1,
                          time: 1500 //2秒关闭（如果不配置，默认是3秒）
                      }, function(){
                          //更新表格

                      });
                  }
                  else if(d ===1){
                      $.ajax({
                          url:'../user/checkpower'
                          ,type:'Post'
                          ,data: data.field
                          ,success:function (a){
                                  window.location.href=a;
                          }
                      });
                      alert("欢迎登录！！")
                      layer.msg('欢迎登录！',{
                          icon: 1,
                          time: 3000 });
                  }

              }
          });

          return false;
      });
    });
    </script>
    <!-- 底部结束 -->

</body>
</html>